<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "quiz.Question" %>
<% 
	Question q = (Question)request.getAttribute("currentQuestion");
	String title = "Question "+q.getPriority();
	String pageTitle = title + " | Quizzard";
%>
<jsp:include page="templates/header.jsp" flush="true">
	<jsp:param value = "<%= pageTitle %>" name = "title" />
</jsp:include>
<jsp:include page="templates/title_bar.jsp" flush = "true">
	<jsp:param value = "<%= title %>" name = "title" />
</jsp:include>
<div id = "content">
<div class = "center">
<%
	String success = (String)request.getAttribute("success");
	String error = (String)request.getAttribute("error");
		
	if (error != null) {
		out.println("<div id = 'error'>"+error+"</div>");
	} else if (success != null) {
		out.println("<div id = 'success'>"+success+"</div>");
	} else {
		request.setAttribute("shouldAllowAnswer", true);
	}
%>
<form method = "post" action = "Question">
<%
	request.setAttribute("isInline", "false");
%>
	<jsp:include page = "templates/display-question.jsp" />
<input type = "hidden" name = "numQuestions" value = "1"/>
<% if (request.getAttribute("shouldAllowAnswer") != null && (Boolean)request.getAttribute("shouldAllowAnswer")) { %>
<input type = "submit" class = "btn" value = "Submit Answer" />
<% } else {  %>
<a href = "Question"><span class = "btn">Continue</span></a>
<% } %>
</form>
</div>
</div>
<jsp:include page="templates/footer.jsp" flush="true" />